package com.maxd.modules.member.controller;


import com.maxd.error.Result;
import com.maxd.modules.member.entity.Member;
import com.maxd.modules.member.service.IMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "会员", tags = {"会员"})

@RequestMapping(value = "/member")
public class MemberController {

    @Autowired
    private IMemberService memberService;

    @PostMapping("/saveMember")
    @ApiOperation("添加会员配置")
    public Result saveMember(@RequestBody Member member){
        return memberService.saveMember(member);
    }

    @PostMapping("/deleteMember")
    @ApiOperation("修改会员配置")
    public Result deleteMember(Long memberId){
        return memberService.deleteMember(memberId);
    }

    @GetMapping("/selectMemberList")
    @ApiOperation("查询会员配置列表")
    public Result selectMemberList(Integer page,Integer size){
        return memberService.selectMemberList(page, size);
    }

    @GetMapping("/selectMemberListByUserId")
    @ApiOperation("查询会员配置列表")
    public Result selectMemberListByUserId(Integer page,Integer size,Long userId){
        return memberService.selectMemberListByUserId(page, size,userId);
    }


    @PostMapping("/setUserMember")
    @ApiOperation("给用户设置会员")
    public Result setUserMember(Long userId,Long memberId){
        return memberService.setUserMember(userId,memberId);
    }



}
